from django.shortcuts import render
from django.shortcuts import HttpResponse
# Create your views here.


def index(request):
    return render(request, 'index.html')


def initCode(request):
    import os
    tag = 'False'
    passwd = request.META['HTTP_X_GITEE_TOKEN']
    print(passwd)
    if passwd == '9cf%r$*^fxhh39&qu(w*xh02xg7_%8o@*+qftjstewekyh&do':
        result = os.popen('nohup sh /opt/logs/initCode.sh >> /opt/logs/initCode.log 2>&1 &')
        tag = 'ok'
        print(result.read())
    return HttpResponse(content=tag)
